const seq = require('../connection/mysql_connect'),
      { STRING, INT, DECIMAL } = require('../../config/db_type_config');


const RecomCourse = seq.define('recom_course', {
    cid: {
        comment: 'course ID',
        type: INT,
        allowNull: false,
        unique: true // 唯一
    },
    href: {
        comment: 'course detail page link',
        type: STRING,
        allowNull: false
    },
    mainTitle: {
        comment: 'Page category title',
        type: STRING,
        allowNull: false
    },
    title: {
        comment: 'course name',
        type: STRING,
        allowNull: false
    },
    posterUrl: {
        comment: 'course poster image',
        type: STRING,
        allowNull: false
    },
    description: {
        comment: 'course description',
        type: STRING,
        // allowNull: false
    },
    teacherImg: {
        comment: 'teacher image',
        type: STRING,
        allowNull: false
    },
    teacherName: {
        comment: 'teacher name',
        type: STRING,
        allowNull: false
    },
    studentCount: {
        comment: 'count of students who purchased this course',
        type: INT,
        allowNull: false
    },
    price: {
        comment: 'course price',
        type: DECIMAL,
        allowNull: false
    },
    posterKey: {
        comment: 'qiniu course image name',
        type: STRING,
        allowNull: false
    },
    teacherImgKey: {
        comment: 'qiniu teacher image name',
        type: STRING,
        allowNull: false
    },
    status: {
        comment: 'recomCourse status',
        type: INT, // 类型
        defaultValue: 1, // 默认值
        allowNull: false, // 是否允许为空
    }
});

module.exports = RecomCourse;